﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Ext_AddDocument]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Ext_AddDocument];
GO
CREATE PROCEDURE [dbo].[sproc_Ext_AddDocument] 
    @ClassID int,
    @DocTitle As nvarchar(300), 
    @DocContent As ntext, 
    @DocApprover As nvarchar(300), 
        @DocApproveDate As nvarchar(20), 
    @DocApproved As int, 
        @DocType As Int, 
        @DocAttribute As int, 
    @DocAddedBy As nvarchar(300), 
    @DocAddedDate As Datetime,
          @CurrentDocID  [int] OUTPUT
AS

Insert Into UDS_document 
    (ClassID,DocTitle,DocContent,DocApprover,DocApproveDate,DocApproved,DocType,DocAttribute,DocAddedBy,DocAddedDate)
    values (@ClassID,@DocTitle,@DocContent,@DocApprover,@DocApproveDate,@DocApproved,@DocType,@DocAttribute,@DocAddedBy,@DocAddedDate)

select @CurrentDocID=@@identity